<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // new Promise((res, rej) => {
        //     // res('01')
        //     rej('err01')
        // }).then(val => {
        //     console.log(val);
        //     return '02'
        // }).then(val => {
        //     console.log(val);
        //     return '03'
        // }).then(val => {
        //     console.log(val);
        // }).catch(rea => {
        //     console.log(rea);
        // })


        new Promise((res, rej) => {
            // res('01')
            rej('err01')
        }).then(val => {
            console.log(val);
            return '02'
        }, rea => {
            return '123';
        }).then(val => {
            console.log(val); //123
            return new Promise((res) => {
                res('ok')
            })
        }).then(val => {
            console.log(val); //ok
        }, rea => {
            throw '错误'
        }).catch(rea => {
            console.log(rea);
        })
    </script>
</body>

</html>